from dataclasses import dataclass
from typing import Optional, Any


@dataclass
class AddAppUpCountRequest:
    """应用计数上报请求"""
    Sessionid: str  # 会话ID，通常使用设备ID


@dataclass
class AddAppUpCountResponse:
    """应用计数上报响应"""
    code: int  # 状态码，0表示成功
    msg: str  # 响应消息
    timestamp: int  # 时间戳
    data: bool  # 响应数据，表示是否成功
    
    @classmethod
    def from_dict(cls, data: dict):
        """从字典创建响应对象"""
        return cls(
            code=data.get('code', -1),
            msg=data.get('msg', ''),
            timestamp=data.get('timestamp', 0),
            data=data.get('data', False)
        )
